import java.util.Scanner;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()){
            int num = sc.nextInt();  //歌曲数量
            String order = sc.next();  //输入顺序字符串
            int[] arr = new int[num];
            //初始化歌曲列表，下标从0开始，0下标存1
            for (int i = 1; i <= num; i++) {
                arr[i-1] = i;
            }
            int display = num >= 4 ? 3 : num-1;
            int tempIndex = 0;  //表示当前光标的位置
            int begin = 0;  //歌单顶部
            int end = display; //歌单底部
            for (int i = 0; i < order.length(); i++) {
                if (order.charAt(i) == 'U'){
                    if (tempIndex == 0){
                        tempIndex = arr.length - 1;
                        end = tempIndex;
                        begin = tempIndex - display;
                    }else {
                        tempIndex -= 1 ;
                        if (tempIndex < begin){
                            begin = tempIndex;
                            end = begin + display;
                        }
                    }
                //操作为D
                }else {
                    if (tempIndex == arr.length - 1){
                        tempIndex = 0;
                        begin = 0;
                        end = display;
                    }else {
                        tempIndex += 1 ;
                        if (tempIndex > end){
                            begin++;
                            end++;
                        }
                    }
                }
            }
            StringBuilder sb = new StringBuilder();
            for (int i = begin; i <= end; i++) {
                sb.append(arr[i] + " ");
            }
            System.out.println(sb.toString().trim());
            System.out.println(arr[tempIndex]);
        }
    }
}